﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;

namespace LabMS.Web.ScoreQueryStudent
{
    public partial class ScoreQuery : Base.BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            strPageUserType.Add("student");
            if (!IsPostBack)
            {
                YearDDL_DataBind();
                ExScoreGridView_DataBind();
            }
        }

        //绑定Gridview
        protected void ExScoreGridView_DataBind()
        {
            ExtendBLL.Score sco = new ExtendBLL.Score();
            DataSet ds = new DataSet();

            ds = sco.ScoreQueryByStudentCode(UserCode,YearDDL.SelectedValue,TermDDL.SelectedValue);

            ExScoreGridView.DataSource = ds;
            ExScoreGridView.DataBind();
        }

        //索引改变 ddl
        protected void DropDownList_OnSelectedIndexChange(object sender, EventArgs e)
        {
            ExScoreGridView_DataBind();
        }
        //绑定学年
        protected void YearDDL_DataBind()
        {
            ExtendBLL.Dictionary eDictionary = new ExtendBLL.Dictionary();
            List<Model.Dictionary> listCClass = new List<LabMS.Model.Dictionary>();
            listCClass = eDictionary.GetModelList("DClass = 'ruxuenianfen' order by Code desc");
            YearDDL.DataSource = listCClass;
            YearDDL.DataTextField = "Name";
            YearDDL.DataValueField = "Code";
            YearDDL.DataBind();
        }

        //分页
        protected void ExScoreGV_OnPageIndexChange(object sender, GridViewPageEventArgs e)
        {
            ExScoreGridView.PageIndex = e.NewPageIndex;
            ExScoreGridView_DataBind();
        }
    }
}
